/*
* Copyright (C) 2024-2025 Uniontech Technology Co., Ltd.
*
* Author:      zhangbingyi <zhangbingyia@uniontech.com>
*
* Maintainer:  zhangbingyi <zhangbingyia@uniontech.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TPPOLICYINFO_H
#define TPPOLICYINFO_H

#include "trustedprotectiondefinition.h"

#include <QtCore/QString>
#include <QtDBus/QtDBus>
#include <QDBusMetaType>
#include <QtCore/QList>

struct TPPolicyInfo {
    int action;
    int func;
    int appRaise;
    QString targetPath;
    QString imaType;
    int policyType;
    int customPolicyType;
    int policyModifyType;
    // 初始化
    // 给出恰当的初始值
    // 注意，修改时必须遵照系统组建议
    bool operator==(const TPPolicyInfo &);
    TPPolicyInfo()
    {
        action = 1; // 不关心的值
        func = 1; // 不关心的值
        appRaise = 2; // 不关心的值
        targetPath = ""; // 路径，插入时填充
        imaType = ""; // 不关心的值
        policyType = POLICY_CUSTOM;
        customPolicyType = CustomPolicyWarn;
        policyModifyType = IMA_POLICY_MODIFY_ADD;
    }
};

Q_DECLARE_METATYPE(TPPolicyInfo);
QDBusArgument &operator<<(QDBusArgument &argument, const TPPolicyInfo &procInfo);
const QDBusArgument &operator>>(const QDBusArgument &argument, TPPolicyInfo &procInfo);

typedef QList<TPPolicyInfo> TPPolicyInfoList;
Q_DECLARE_METATYPE(TPPolicyInfoList);

void registerTPPolicyInfoMetaType();
void registerTPPolicyInfoListMetaType();

#endif // TPPOLICYINFO_H
